<template>
    <div class="icon-index">
        <div class="item" v-for="item in props.list" :key="item.name" :style="`width:${100 / row}%`">
            <div class="content">
                <div class="top">
                    <div class="count" :style="item.red ? 'color:#ff6c83' : ''">
                        {{ item.count }}
                    </div>
                    <div class="unit">{{ item.unit }}</div>
                </div>
                <div class="bottom">
                    {{ item.name }}
                </div>
            </div>
        </div>
    </div>
</template>

<script lang="ts" setup>
import { PropType } from 'vue'
interface item {
    name: string
    count: number
    unit: string
    red: boolean
}

const props = defineProps({
    list: {
        type: Object as PropType<item[]>,
        default: () => {
            return [
                {
                    name: '响应率',
                    count: 100,
                    unit: '%'
                },
                {
                    name: '完单率',
                    count: 100,
                    unit: '%'
                },
                {
                    name: '响应率',
                    count: 100,
                    unit: '%'
                },
                {
                    name: '完单率',
                    count: 100,
                    unit: '%'
                }
            ]
        }
    },
    row: {
        type: Number,
        default: 4
    }
})
</script>

<style lang="scss" scoped>
.icon-index {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    .item {
        width: 50%;
        padding: 5px;
        .content {
            width: 100%;
            display: flex;
            flex-direction: column;
            align-items: center;
            height: 110px;
            padding-top: 10px;
            background: url('./image/dataItemBox_bg@2x.png') no-repeat;
            background-size: 100% 100%;
            .top {
                display: flex;
                align-items: center;
                height: 80px;
                .count {
                    font-family: Tencent, serif;
                    color: #86dbff;
                    font-size: 26px;
                    padding-bottom: 5px;
                }
                .unit {
                    font-size: 24px;
                    padding-left: 5px;
                    font-family: OPPOSans;
                    letter-spacing: 1px;
                    color: #ffffffdd;
                }
            }
            .bottom {
                margin-top: 0;
                font-size: 24px;
                font-family: OPPOSans;
                letter-spacing: 1px;
                color: #ffffffdd;
            }
        }
    }
}
</style>
